package remote.controls
{
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	import remote.utils.DisplayObjectUtil;
	
	/**
	 * 竖直滚动条
	 * @author 银魂飞雪
	 * @createDate 2011-3-12
	 */
	public class VSlider extends SliderBase
	{
		public function VSlider()
		{
			super();
		}
		
		override protected function pointToValue(x:Number, y:Number):Number
		{
			var result:Number =  y * (this._maxValue - _minValue) / (_track.height - _thumb.height);
			if(this._stepSize != 0)
				result = (Math.floor(result / _stepSize)) * _stepSize;
			return result;
		}
		override protected function valueToPoint(value:Number):Point
		{
			return new Point(_thumb.x, value * (_track.height - _thumb.height) / (maxValue - minValue));
		}
		
		override protected function dragRect():Rectangle
		{
			return  new Rectangle(0, _track.y, 0, _track.height - _thumb.height)
		}
		override protected function createChildren():void
		{
			super.createChildren();
			_track.setSize(width, height);
			_thumb.setSize(width, 10);
		}
		
		override protected function initProperty():void
		{
			super.initProperty();
			_width = 10;
			_height = 100;
		}
		

	}
}